package com.gitee.form_token.exception;

import org.springframework.security.access.AccessDeniedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * 解决 GlobalExceptionHandler 会消费掉 AccessDeniedException,
 * 导致 AccessDeniedHandler 不被触发的问题
 **/
@ControllerAdvice
public class AccessDeniedExceptionHandler {
    @ExceptionHandler(AccessDeniedException.class)
    public void accessDeniedException(AccessDeniedException ex) throws AccessDeniedException {
        throw ex;
    }
}
